package com.hns.phone.base.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hns.can.common.constants.GlobalConst;
import com.hns.can.common.entity.BaseEntity;
import com.hns.can.common.formula.FillCodeDscValue;
import com.hns.can.common.formula.FillParamsVo;
import com.hns.can.master.entity.BaseCarInfoEntity;
import com.hns.frame.service.CommonService;
import com.hns.tool.pub.PubUtil;
@Service
public class PhoneBaseCarInfoService extends CommonService {
	
	@Autowired
    private FillCodeDscValue codeDscValue;
	
	/**
	    * 根据车辆id求车辆信息
	    * @param carId
	    * @return
	    * @throws Exception
	    * @author:lan
	    * @email:763836737@qq.com
	    */
	    @SuppressWarnings({"unchecked"})
	    public BaseEntity getCarInfoByCarId(String carId) throws Exception {
	        List<BaseEntity> list = PubUtil.convertListMapToObject(
	            this.sqlMapDao.selectList("phoneBaseCarInfo.getCarInfoByCarId", carId), BaseCarInfoEntity.class);
	        Map<String,String> map = new HashMap<String,String>();
	        map.put("corpName", GlobalConst.DEFAULT_CACHE_VALUE);   
	        FillParamsVo vo1 = new FillParamsVo("corpId", map);
	        Map<String,String> map2 = new HashMap<String,String>();
	        map2.put("organName", GlobalConst.DEFAULT_CACHE_VALUE);
	        FillParamsVo vo2 = new FillParamsVo("organId", map2);
	        
	        Map<String,String> map3 = new HashMap<String,String>();
	        map3.put("drvName", GlobalConst.DEFAULT_CACHE_VALUE);
	        FillParamsVo vo3 = new FillParamsVo("drvId", map3);
	        
	        codeDscValue.fillInfoValue(list, new String[] {GlobalConst.CACHE_KEY_SYS_CORP, 
	        		GlobalConst.CACHE_KEY_BASE_ORGAN, GlobalConst.CACHE_KEY_BASE_DRV_INFO},vo1, vo2, vo3);
	        return list.get(0);
	    }
}
